using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.Task.Data;
using ReviewTable = CentralOffice.Task.Data.TaskReviewDataSet.TaskReviewDataTable;
using ReviewRow = CentralOffice.Task.Data.TaskReviewDataSet.TaskReviewRow;

namespace CentralOffice.Task.DataAccess
{
    public class TaskReviewAdapter : DataAccessAdapter<CentralOffice.Task.Data.TaskReviewDataSet, ReviewTable, ReviewRow>
    {
        public TaskReviewAdapter()
        {
            //this.TableName = "TaskProgress";

            GetAllStoredProc = "Tasks.TaskReview_SelectTaskReviewsAll";
            InsertStoredProc = "Tasks.TaskReview_InsertTaskReview";
            UpdateStoredProc = "Tasks.TaskReview_UpdateTaskReview";
            DeleteStoredProc = "Tasks.TaskReview_DeleteTaskReview";

            GetByIdStoredProc = "Tasks.TaskReview_SelectTaskReview";
            GetByNameStoredProc   = "";
            GetPagedStoredProc = "Tasks.TaskReview_SelectTaskReviewsPaged";
            GetRowCountStoredProc = "Tasks.TaskReview_SelectTaskReviewsRowCount";
        }
        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "Id", DbType.Guid, "Id", DataRowVersion.Current);
            db.AddInParameter(cmd, "Name", DbType.String, "Name", DataRowVersion.Current);
            db.AddInParameter(cmd, "Comment", DbType.String, "Comment", DataRowVersion.Current);
            db.AddInParameter(cmd, "TaskId", DbType.Guid, "TaskId", DataRowVersion.Current);
            db.AddInParameter(cmd, "Attachments", DbType.String, "Attachments", DataRowVersion.Current);
            db.AddInParameter(cmd, "IsDeleted", DbType.Boolean, "IsDeleted", DataRowVersion.Current);
            db.AddInParameter(cmd, "IsActive", DbType.Boolean, "IsActive", DataRowVersion.Current);
            db.AddInParameter(cmd, "CreatedTime", DbType.DateTime, "CreatedTime", DataRowVersion.Current);
            db.AddInParameter(cmd, "CreatedBy", DbType.String, "CreatedBy", DataRowVersion.Current);
            db.AddInParameter(cmd, "ModifiedTime", DbType.DateTime, "ModifiedTime", DataRowVersion.Current);
            db.AddInParameter(cmd, "LastModifiedBy", DbType.String, "LastModifiedBy", DataRowVersion.Current);
            db.AddInParameter(cmd, "Version", DbType.Int32, "Version", DataRowVersion.Current);
            db.AddInParameter(cmd, "Description", DbType.String, "Description", DataRowVersion.Current);
        }
    }
}
